/*******************************************************************************
Description:  Defines a list scheduler, based on the defintions of a generic
              scheduler and a constrained scheduler in gen_sched.h, which
              collectively include the meat of the implementation.
Author:       Ghassan Shobaki
Created:      Apr. 2002
Last Update:  Mar. 2011
*******************************************************************************/

#ifndef OPTSCHED_LIST_SCHED_LIST_SCHED_H
#define OPTSCHED_LIST_SCHED_LIST_SCHED_H

#include "llvm/CodeGen/OptSched/basic/gen_sched.h"

namespace opt_sched {

class ListScheduler : public ConstrainedScheduler {
  public:
    // Creates a list scheduler for the given dependence graph, machine and
    // schedule upper bound, using the specified heuristic.
    ListScheduler(DataDepGraph* dataDepGraph,
                  MachineModel* machMdl,
                  InstCount schedUprBound,
                  LISTSCHED_HEURISTIC mainHurstc);
    virtual ~ListScheduler();

    // Calculates the schedule and returns it in the passed argument.
    FUNC_RESULT FindSchedule(InstSchedule* sched, SchedRegion* rgn);

  private:
    // Adds the instructions that have just become ready at this cycle to the
    // ready list.
    void UpdtRdyLst_(InstCount cycleNum, int slotNum);
};

} // end namespace opt_sched

#endif
